<template>
  <div>
    <el-row>
      <el-col :span="12">
        <v-chart class="chart" :option="option" />
      </el-col>

      <el-col style="margin-left: 60px" :span="4">
        <el-row>
          <el-col>
            <el-card>
              <img src="https://h2.appsimg.com/a.appsimg.com/upload/merchandise/pdcvis/104524/2023/0301/102/0c2b07ba-fd6c-4b56-9a14-a7a395fe979d.jpg" class="image">
              <div>
                <span>镂空长袖薄外套女</span>
                <div class="bottom clearfix">
                  <el-button type="text" class="button">查看详情</el-button>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-col>
      <el-col style="margin-left: 90px" :span="4">
        <el-row>
          <el-col>
            <el-card>
              <img src="https://h2.appsimg.com/a.appsimg.com/upload/merchandise/pdcvis/2022/06/17/172/bd16bae4-e0ef-4025-ae9d-9cbbce01865c.jpg" class="image">
              <div>
                <span>针织衫女减龄短款上衣</span>
                <div class="bottom clearfix">
                  <el-button type="text" class="button">查看详情</el-button>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-col>

    </el-row>
  </div>
</template>

<script>
import { use } from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
import { PieChart } from "echarts/charts";
import {
  TitleComponent,
  TooltipComponent,
  LegendComponent
} from "echarts/components";
import VChart, { THEME_KEY } from "vue-echarts";

use([
  CanvasRenderer,
  PieChart,
  TitleComponent,
  TooltipComponent,
  LegendComponent
]);

export default {
  components: {
    VChart
  },
  provide: {
    [THEME_KEY]: "dark"
  },
  data() {
    return {
      currentDate: new Date(),
      option: {
        title: {
          text: "Traffic Sources",
          left: "center"
        },
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
          orient: "vertical",
          left: "left",
          data: [
            "女装",
            "男装",
            "童装",
            "运动装",
            "医药"
          ]
        },
        series: [
          {
            name: "商品分布图",
            type: "pie",
            radius: "55%",
            center: ["50%", "60%"],
            data: [
              {value: 335, name: "女装"},
              {value: 310, name: "男装"},
              {value: 234, name: "童装"},
              {value: 135, name: "运动装"},
              {value: 1548, name: "医药"}
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)"
              }
            }
          }
        ]
      }
    };
  }
};
</script>

<style scoped>
.chart {
  height: 400px;
}
.time {
  font-size: 13px;
  color: #999;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  padding: 0;
  float: right;
}

.image {
  margin-left: 13px;
  width: 150px;
  height: 150px;
  display: block;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both
}
</style>
